package org.egame.net
{
	import flash.events.Event;
	
	/**
	 * NetClient向上层抛得网络事件
	 */ 
	public class NetClientEvent extends Event
	{
		public	static	const	TYPE_RECV_PACKAGE:String	=	"TYPE_RECV_PACKAGE";//收到远端的网络包
				
		public	static	const	TYPE_CONNECTED:String		=	"TYPE_CONNECTED";//已连接
		
		public	static	const	TYPE_CONNECT_LOST:String	=	"TYPE_CONNECT_LOST";//连接断开
		
		public	static	const	TYPE_IO_ERROR:String		=	"TYPE_IO_ERROR";//与远端建立连接失败，或发送数据失败
		
		public	static	const	TYPE_SECURITY_ERROR:String	=	"TYPE_SECURITY_ERROR";//安全问题，交差域文件引起的
		
		private		var	_pack:JSONPackage; //收到的网络包
		
		public function NetClientEvent(type:String, pack:JSONPackage)
		{
			super(type);
			_pack = pack;
		}

		/**
		 * 返回JSONPackage网络包；只有当on_recv_package事件发生时才会返回网络包，其它事件返回null
		 */ 
		public	function	getJSONPackage():JSONPackage
		{
			return _pack;
		}
		
		
	}
}